The <i><a href="http://www.dukascopy.com/client/javadoc//com/dukascopy/api/IChartPanel.html#add(com.dukascopy.api.indicators.IIndicator, java.lang.Object[], java.awt.Color[], com.dukascopy.api.indicators.OutputParameterInfo.DrawingStyle[], int[])">IChartPanel.add</a></i> methods get used to plot an indicator on chart. One can retrieve parameters and appearance information of already plotted indicators by calling the <i><a href="http://www.dukascopy.com/client/javadoc//com/dukascopy/api/IChartPanel.html#getIndicatorApperanceInfos()">IChartPanel.getIndicatorApperanceInfos</a></i> method. One can also <a href="#Indicator_chart_panels">plot another indicator</a> or chart objects on the same indicator panel.<br/><div class="dw_article_headers_list"><div class="dw_article_header_h1"><a href="#Add_indicators_on_chart/Use_optional_parameters">Use optional parameters</a></div><div class="dw_article_header_h1"><a href="#Add_indicators_on_chart/Specify_output_style">Specify output style</a></div><div class="dw_article_header_h1"><a href="#Add_indicators_on_chart/Use_on-chart_indicator_parameters">Use on-chart indicator parameters</a></div><div class="dw_article_header_h1"><a href="#Add_indicators_on_chart/Include_in_OHLC">Include in OHLC</a></div><div class="dw_article_header_h1"><a href="#Add_indicators_on_chart/Plot_on_newly_opened_chart">Plot on newly opened chart</a></div><div class="dw_article_header_h2"><a href="#Add_indicators_on_chart/Randomize_output_style_and_include_in_OHLC">Randomize output style and include in OHLC</a></div></div><span id="Add_indicators_on_chart/Use_optional_parameters"><h1>Use optional parameters</h1></span>The following methods may be used to add indicators on chart. The latter method lets you specify values for indicator optional parameters.<br/><div class="dw_article_geshi_code">chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>indicators.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ZIGZAG&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>indicators.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ET_Nico&quot;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div><span id="Add_indicators_on_chart/Specify_output_style"><h1>Specify output style</h1></span>Use the following code to specify the applied price, drawing style, colors, etc for the indicator you add:<br/><div class="dw_article_geshi_code">IChart chart <span style="color: #339933;">=</span> context.<span style="color: #006633;">getChart</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Instrument</span>.<span style="color: #006633;">EURUSD</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />IIndicator indCOG <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;COG&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> indCOG.<span style="color: #006633;">getIndicatorInfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getNumberOfInputs</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; InputParameterInfo inputParameterInfo <span style="color: #339933;">=</span> indCOG.<span style="color: #006633;">getInputParameterInfo</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; inputParameterInfo.<span style="color: #006633;">setAppliedPrice</span><span style="color: #009900;">&#40;</span>AppliedPrice.<span style="color: #006633;">LOW</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #009900;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>indCOG, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">6</span>, MaType.<span style="color: #006633;">SMA</span>.<span style="color: #006633;">ordinal</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Color</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #003399;">Color</span>.<span style="color: #006633;">RED</span>, <span style="color: #003399;">Color</span>.<span style="color: #006633;">GREEN</span><span style="color: #009900;">&#125;</span>,<br />&nbsp; <span style="color: #000000; font-weight: bold;">new</span> DrawingStyle<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>DrawingStyle.<span style="color: #006633;">DASHDOT_LINE</span>, DrawingStyle.<span style="color: #006633;">LINE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>Object array <i>optParams</i>, the second parameter of <i>chart.addIndicator</i>, stands for indicator-specific parameters whoes info can be retrieved from <a href="#Indicator_metadata">indicator metadata</a>.<br/><span id="Add_indicators_on_chart/Use_on-chart_indicator_parameters"><h1>Use on-chart indicator parameters</h1></span>As mentioned above, one can retrieve parameters and appearance information of already plotted indicators by calling the <i><a href="http://www.dukascopy.com/client/javadoc//com/dukascopy/api/IChartPanel.html#getIndicatorApperanceInfos()">IChartPanel.getIndicatorApperanceInfos</a></i> method. Consider a strategy which calculates indicators with the same parameters as they appear on the last selected chart:<br/><div class="dw_article_geshi_code"><span style="color: #000000; font-weight: bold;">private</span> IIndicators indicators<span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">private</span> IHistory history<span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">private</span> IConsole console<span style="color: #339933;">;</span><br /><span style="color: #000000; font-weight: bold;">private</span> IChart chart<span style="color: #339933;">;</span><br /><br /><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> dataCount <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span><br /><br />@Override<br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onStart<span style="color: #009900;">&#40;</span>IContext context<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> JFException <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; indicators <span style="color: #339933;">=</span> context.<span style="color: #006633;">getIndicators</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; history <span style="color: #339933;">=</span> context.<span style="color: #006633;">getHistory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; console <span style="color: #339933;">=</span> context.<span style="color: #006633;">getConsole</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; chart <span style="color: #339933;">=</span> context.<span style="color: #006633;">getLastActiveChart</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>chart <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #006633;">getErr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;No chart opened!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; IFeedDescriptor feedDescriptor <span style="color: #339933;">=</span> chart.<span style="color: #006633;">getFeedDescriptor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>feedDescriptor.<span style="color: #006633;">getDataType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> DataType.<span style="color: #006633;">TICKS</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #006633;">getWarn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Tick charts need to get calculate with from-to method&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>IIndicatorAppearanceInfo info <span style="color: #339933;">:</span> chart.<span style="color: #006633;">getIndicatorApperanceInfos</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; AppliedPrice<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> appliedPrices <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AppliedPrice<span style="color: #009900;">&#91;</span>info.<span style="color: #006633;">getDrawingStyles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">length</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Arrays</span>.<span style="color: #006633;">fill</span><span style="color: #009900;">&#40;</span>appliedPrices, AppliedPrice.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> offerSides <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OfferSide<span style="color: #009900;">&#91;</span>info.<span style="color: #006633;">getDrawingStyles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">length</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Arrays</span>.<span style="color: #006633;">fill</span><span style="color: #009900;">&#40;</span>offerSides, chart.<span style="color: #006633;">getSelectedOfferSide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IIndicator indicator <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span>info.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ITimedData feedData <span style="color: #339933;">=</span> history.<span style="color: #006633;">getFeedData</span><span style="color: #009900;">&#40;</span>feedDescriptor, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> result <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>feedDescriptor, offerSides, info.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, appliedPrices, info.<span style="color: #006633;">getOptParams</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, dataCount, feedData<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> indicator.<span style="color: #006633;">getIndicatorInfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getNumberOfOutputs</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OutputParameterInfo.<span style="color: #006633;">Type</span> outputType <span style="color: #339933;">=</span> indicator.<span style="color: #006633;">getOutputParameterInfo</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> resultStr <span style="color: #339933;">=</span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outputType <span style="color: #339933;">==</span> OutputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">DOUBLE</span> <span style="color: #339933;">?</span> <span style="color: #003399;">Arrays</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> result<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">:</span> outputType <span style="color: #339933;">==</span> OutputParameterInfo.<span style="color: #006633;">Type</span>.<span style="color: #006633;">INT</span> <span style="color: #339933;">?</span> <span style="color: #003399;">Arrays</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> result<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;object outputs need special processing&quot;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #006633;">getOut</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%s %s last %s values: %s&quot;</span>, info.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, indicator.<span style="color: #006633;">getOutputParameterInfo</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, dataCount, resultStr<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; context.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #009900;">&#125;</span></div><a href="https://www.dukascopy.com/wiki/https://www.dukascopy.com/wiki/files/CalculateIndicatorsFromChart.java">CalculateIndicatorsFromChart.java</a><br/><span id="Add_indicators_on_chart/Include_in_OHLC"><h1>Include in OHLC</h1></span>Consider a strategy which plots EMA and MACD indicators on chart and adds an OHLC informer with indicator showing option. The strategy also calculates the indicators on every bar, such that one can verify that the values match:<br/><img src="https://www.dukascopy.com/wiki/files//macdEmaOhlc.png" border="0" /><br/>The function that adds the indicators and the OHLC informer:<br/><div class="dw_article_geshi_code"><br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onStart<span style="color: #009900;">&#40;</span>IContext context<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> JFException <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">console</span> <span style="color: #339933;">=</span> context.<span style="color: #006633;">getConsole</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">indicators</span> <span style="color: #339933;">=</span> context.<span style="color: #006633;">getIndicators</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; IChart chart <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>IChart c <span style="color: #339933;">:</span> context.<span style="color: #006633;">getCharts</span><span style="color: #009900;">&#40;</span>instrument<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">getSelectedOfferSide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">side</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&amp;&amp;</span> c.<span style="color: #006633;">getSelectedPeriod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">period</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&amp;&amp;</span> c.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">filter</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chart <span style="color: #339933;">=</span> c<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">filter</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #006633;">getErr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Filter dismatch! Change in platform settings the filter to the same one that the strategy is using!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>chart <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; chart <span style="color: #339933;">=</span> context.<span style="color: #006633;">openChart</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TimePeriodAggregationFeedDescriptor<span style="color: #009900;">&#40;</span>instrument, period, side, filter<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>indicators.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;EMA&quot;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> emaTimePeriod <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>indicators.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MACD&quot;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> macdFastPeriod, macdSlowPeriod, macdSignalPeriod <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><br />&nbsp; &nbsp; IOhlcChartObject ohlc <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>IChartObject obj <span style="color: #339933;">:</span> chart.<span style="color: #006633;">getAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>obj <span style="color: #000000; font-weight: bold;">instanceof</span> IOhlcChartObject<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ohlc <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>IOhlcChartObject<span style="color: #009900;">&#41;</span> obj<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ohlc <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ohlc <span style="color: #339933;">=</span> chart.<span style="color: #006633;">getChartObjectFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">createOhlcInformer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>ohlc<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; ohlc.<span style="color: #006633;">setShowIndicatorInfo</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//calculate on the previous bar over candle interval such that the filters get used</span><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">long</span> time <span style="color: #339933;">=</span> context.<span style="color: #006633;">getHistory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, period, side, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> macd <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">macd</span><span style="color: #009900;">&#40;</span>instrument, period, side, AppliedPrice.<span style="color: #006633;">CLOSE</span>, macdFastPeriod, macdSlowPeriod, macdSignalPeriod, filter, <span style="color: #cc66cc;">1</span>, time, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> ema <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">ema</span><span style="color: #009900;">&#40;</span>instrument, period, side, AppliedPrice.<span style="color: #006633;">CLOSE</span>, emaTimePeriod, filter, <span style="color: #cc66cc;">1</span>, time, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; console.<span style="color: #006633;">getOut</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%s - ema=%s, macd=%s (by candle interval)&quot;</span>, DateUtils.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span>time<span style="color: #009900;">&#41;</span>, arrayToString<span style="color: #009900;">&#40;</span>ema<span style="color: #009900;">&#41;</span>, arrayToString<span style="color: #009900;">&#40;</span>macd<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #009900;">&#125;</span></div><a href="https://www.dukascopy.com/wiki/files//PlotEmaMacdWithOhlc.java">PlotEmaMacdWithOhlc.java</a><br/>Also consider a generalized version that works with any feed:<br/><a href="https://www.dukascopy.com/wiki/https://www.dukascopy.com/wiki/files/PlotEmaMacdWithOhlcFeed.java">PlotEmaMacdWithOhlcFeed.java</a><br/><span id="Add_indicators_on_chart/Plot_on_newly_opened_chart"><h1>Plot on newly opened chart</h1></span>Consider creating a wrapper class which describes both the indicator data and the feed it is supposed to be calculated on:<br/><div class="dw_article_geshi_code"><span style="color: #000000; font-weight: bold;">class</span> IndDataAndFeed<span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> IFeedDescriptor feedDescriptor<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> indicatorName<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> optionalInputs<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> outputIndex<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> IIndicator indicator<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> IChart chart<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> IndDataAndFeed<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> indicatorName, <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> optionalInputs, <span style="color: #000066; font-weight: bold;">int</span> outputIndex, IFeedDescriptor feedDescriptor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">feedDescriptor</span> <span style="color: #339933;">=</span> feedDescriptor<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">indicatorName</span> <span style="color: #339933;">=</span> indicatorName<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">optionalInputs</span> <span style="color: #339933;">=</span> optionalInputs<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">outputIndex</span> <span style="color: #339933;">=</span> outputIndex<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> openChartAddIndicator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>IChart openedChart <span style="color: #339933;">:</span> context.<span style="color: #006633;">getCharts</span><span style="color: #009900;">&#40;</span>feedDescriptor.<span style="color: #006633;">getInstrument</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IFeedDescriptor chartFeed <span style="color: #339933;">=</span> openedChart.<span style="color: #006633;">getFeedDescriptor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>chartFeed.<span style="color: #006633;">getPeriod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> feedDescriptor.<span style="color: #006633;">getPeriod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> chartFeed.<span style="color: #006633;">getOfferSide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> feedDescriptor.<span style="color: #006633;">getOfferSide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chart <span style="color: #339933;">=</span> openedChart<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>chart <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chart <span style="color: #339933;">=</span> context.<span style="color: #006633;">openChart</span><span style="color: #009900;">&#40;</span>feedDescriptor<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>chart.<span style="color: #006633;">getFeedDescriptor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> feedDescriptor.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #006633;">getErr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Chart filter &quot;</span> <span style="color: #339933;">+</span> chart.<span style="color: #006633;">getFeedDescriptor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; does not match indicator feed filter &quot;</span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span> &nbsp;feedDescriptor.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; please adjust the platform settings&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; indicator <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span>indicatorName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>indicator, optionalInputs<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">double</span> getCurrentValue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> JFException<span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> outputs <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>feedDescriptor, <span style="color: #000000; font-weight: bold;">new</span> OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> feedDescriptor.<span style="color: #006633;">getOfferSide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span>,indicatorName,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> AppliedPrice<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> AppliedPrice.<span style="color: #006633;">CLOSE</span> <span style="color: #009900;">&#125;</span>, optionalInputs, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">double</span> value <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Double</span><span style="color: #009900;">&#41;</span> outputs<span style="color: #009900;">&#91;</span>outputIndex<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> value<span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> removeFromChart<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>chart <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> indicator <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chart.<span style="color: #006633;">removeIndicator</span><span style="color: #009900;">&#40;</span>indicator<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; @Override <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> toString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #003399;">String</span>.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%s %s on %s %s feed&quot;</span>, indicatorName, <span style="color: #003399;">Arrays</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span>optionalInputs<span style="color: #009900;">&#41;</span>, feedDescriptor.<span style="color: #006633;">getOfferSide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, feedDescriptor.<span style="color: #006633;">getPeriod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br /><span style="color: #009900;">&#125;</span></div>Then add a list of indicators which you wish to calculate and plot on respective chart:<br/><div class="dw_article_geshi_code">@Configurable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Instrument</span> instrument <span style="color: #339933;">=</span> <span style="color: #003399;">Instrument</span>.<span style="color: #006633;">EURUSD</span><span style="color: #339933;">;</span><br /><br /><span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>IndDataAndFeed<span style="color: #339933;">&gt;</span> calculatableIndicators <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>IndDataAndFeed<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Arrays</span>.<span style="color: #006633;">asList</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> IndDataAndFeed<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IndDataAndFeed<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MACD&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">12</span>,<span style="color: #cc66cc;">26</span>,<span style="color: #cc66cc;">9</span><span style="color: #009900;">&#125;</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">new</span> TimePeriodAggregationFeedDescriptor<span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">FIVE_MINS</span>, OfferSide.<span style="color: #006633;">BID</span>, Filter.<span style="color: #006633;">WEEKENDS</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IndDataAndFeed<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;RSI&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#125;</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">new</span> TimePeriodAggregationFeedDescriptor<span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">FIVE_MINS</span>, OfferSide.<span style="color: #006633;">BID</span>, Filter.<span style="color: #006633;">WEEKENDS</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IndDataAndFeed<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;RSI&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#125;</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">new</span> TimePeriodAggregationFeedDescriptor<span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">ONE_HOUR</span>, OfferSide.<span style="color: #006633;">BID</span>, Filter.<span style="color: #006633;">WEEKENDS</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IndDataAndFeed<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CCI&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">14</span><span style="color: #009900;">&#125;</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">new</span> TimePeriodAggregationFeedDescriptor<span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">FIFTEEN_MINS</span>, OfferSide.<span style="color: #006633;">BID</span>, Filter.<span style="color: #006633;">WEEKENDS</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>,<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IndDataAndFeed<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CCI&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">14</span><span style="color: #009900;">&#125;</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #000000; font-weight: bold;">new</span> TimePeriodAggregationFeedDescriptor<span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">ONE_HOUR</span>, OfferSide.<span style="color: #006633;">BID</span>, Filter.<span style="color: #006633;">WEEKENDS</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br /><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>And finally make calls from the strategy:<br/><div class="dw_article_geshi_code">@Override<br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onStart<span style="color: #009900;">&#40;</span>IContext context<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> JFException <span style="color: #009900;">&#123;</span><br /><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>context.<span style="color: #006633;">getSubscribedInstruments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span>instrument<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; context.<span style="color: #006633;">setSubscribedInstruments</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> HashSet<span style="color: #339933;">&lt;</span>Instrument<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Arrays</span>.<span style="color: #006633;">asList</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Instrument</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>instrument<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">context</span> <span style="color: #339933;">=</span> context<span style="color: #339933;">;</span><br />&nbsp; &nbsp; console <span style="color: #339933;">=</span> context.<span style="color: #006633;">getConsole</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; indicators <span style="color: #339933;">=</span> context.<span style="color: #006633;">getIndicators</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>IndDataAndFeed indDataAndFeed <span style="color: #339933;">:</span> calculatableIndicators<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; indDataAndFeed.<span style="color: #006633;">openChartAddIndicator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><span style="color: #009900;">&#125;</span><br /><br />@Override<br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onTick<span style="color: #009900;">&#40;</span><span style="color: #003399;">Instrument</span> instrument, ITick tick<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> JFException <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>instrument <span style="color: #339933;">!=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">instrument</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>IndDataAndFeed indDataAndFeed <span style="color: #339933;">:</span> calculatableIndicators<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">double</span> value <span style="color: #339933;">=</span> indDataAndFeed.<span style="color: #006633;">getCurrentValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; print<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;%s current value=%.5f&quot;</span>, indDataAndFeed, value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><span style="color: #009900;">&#125;</span><br /><br />@Override<br /><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onStop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> JFException <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>IndDataAndFeed indDataAndFeed <span style="color: #339933;">:</span> calculatableIndicators<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; indDataAndFeed.<span style="color: #006633;">removeFromChart</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><span style="color: #009900;">&#125;</span></div><a href="https://www.dukascopy.com/wiki/files//FeedMultiIndOpenCharts.java">FeedMultiIndOpenCharts.java</a><br/><span id="Add_indicators_on_chart/Randomize_output_style_and_include_in_OHLC"><h2>Randomize output style and include in OHLC</h2></span>Consider modifying the previous example, by modifying the indicator ouput styles and including the indicator values in the OHLC information object:<br/><div class="dw_article_geshi_code"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> openChartAddIndicator<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>IChart openedChart <span style="color: #339933;">:</span> context.<span style="color: #006633;">getCharts</span><span style="color: #009900;">&#40;</span>feedDescriptor.<span style="color: #006633;">getInstrument</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; IFeedDescriptor chartFeed <span style="color: #339933;">=</span> openedChart.<span style="color: #006633;">getFeedDescriptor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>chartFeed.<span style="color: #006633;">getPeriod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> feedDescriptor.<span style="color: #006633;">getPeriod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> chartFeed.<span style="color: #006633;">getOfferSide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> feedDescriptor.<span style="color: #006633;">getOfferSide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; chart <span style="color: #339933;">=</span> openedChart<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>chart <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; chart <span style="color: #339933;">=</span> context.<span style="color: #006633;">openChart</span><span style="color: #009900;">&#40;</span>feedDescriptor<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>chart.<span style="color: #006633;">getFeedDescriptor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> feedDescriptor.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #006633;">getErr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Chart filter &quot;</span> <span style="color: #339933;">+</span> chart.<span style="color: #006633;">getFeedDescriptor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; does not match indicator feed filter &quot;</span> <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span> &nbsp;feedDescriptor.<span style="color: #006633;">getFilter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; please adjust the platform settings&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; context.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; indicator <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">getIndicator</span><span style="color: #009900;">&#40;</span>indicatorName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> outputCount <span style="color: #339933;">=</span> indicator.<span style="color: #006633;">getIndicatorInfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getNumberOfOutputs</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #003399;">Color</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> colors <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Color</span><span style="color: #009900;">&#91;</span>outputCount<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; DrawingStyle<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> styles <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DrawingStyle<span style="color: #009900;">&#91;</span>outputCount<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> widths <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span>outputCount<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> outIdx <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> outIdx<span style="color: #339933;">&lt;</span> outputCount<span style="color: #339933;">;</span> outIdx<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; OutputParameterInfo outInfo <span style="color: #339933;">=</span> indicator.<span style="color: #006633;">getOutputParameterInfo</span><span style="color: #009900;">&#40;</span>outIdx<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>outInfo <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #006633;">getErr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>indicatorName <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; &quot;</span> &nbsp;<span style="color: #339933;">+</span> outIdx <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;is null&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">continue</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//make colors darker</span><br />&nbsp; &nbsp; &nbsp; &nbsp; colors<span style="color: #009900;">&#91;</span>outIdx<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Color</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">nextInt</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">256</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">256</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">256</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//make solid-line inputs dashed</span><br />&nbsp; &nbsp; &nbsp; &nbsp; styles<span style="color: #009900;">&#91;</span>outIdx<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> outInfo.<span style="color: #006633;">getDrawingStyle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> DrawingStyle.<span style="color: #006633;">LINE</span> <span style="color: #339933;">?</span> DrawingStyle.<span style="color: #006633;">DASH_LINE</span> <span style="color: #339933;">:</span> outInfo.<span style="color: #006633;">getDrawingStyle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//thicken the 1-width lines</span><br />&nbsp; &nbsp; &nbsp; &nbsp; widths<span style="color: #009900;">&#91;</span>outIdx<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>indicator, optionalInputs, colors, styles, widths<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//show indicator values in ohlc</span><br />&nbsp; &nbsp; IOhlcChartObject ohlc <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>IChartObject obj <span style="color: #339933;">:</span> chart.<span style="color: #006633;">getAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>obj <span style="color: #000000; font-weight: bold;">instanceof</span> IOhlcChartObject<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ohlc <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>IOhlcChartObject<span style="color: #009900;">&#41;</span> obj<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ohlc <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; ohlc <span style="color: #339933;">=</span> chart.<span style="color: #006633;">getChartObjectFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">createOhlcInformer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; chart.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>ohlc<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; ohlc.<span style="color: #006633;">setShowIndicatorInfo</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #009900;">&#125;</span></div><a href="https://www.dukascopy.com/wiki/https://www.dukascopy.com/wiki/files/FeedMultiIndOpenChartsOhlc.java">FeedMultiIndOpenChartsOhlc.java</a>